package com.oasystem.dao.jdbc.fund;

import java.util.List;

import org.springframework.jdbc.core.JdbcTemplate;

import com.oasystem.domain.fund.FundClassification;

public class FundClassificationDao {
	private JdbcTemplate jdbcTemplate;
	
	public List<FundClassification> findAll() {
		String sql="SELECT * FROM FundClassification";
		return jdbcTemplate.queryForList(sql,FundClassification.class);
	}
	
	public void insert(FundClassification fundClassification) {
		String sql = "INSERT INTO permission (name) VALUES (?)";
		jdbcTemplate.update(sql, new Object[]{fundClassification.getName()});
	}

	public void delete(Integer id) {
		String sql = "DELETE FROM FundClassification WHERE id=?";
		jdbcTemplate.update(sql, new Object[]{id});
	}

	public void update(FundClassification fundClassification) {
		String sql = "UPDATE FundClassification SET name=? WHERE id=?";
		jdbcTemplate.update(sql, new Object[]{fundClassification.getName(),fundClassification.getId()});
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
}
